// 需要先计算灯的半径, 然后, 每次找最高, 归类每一行(最顶位置), 最后每一行排序
// 最后遍历输出
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let n;
let initArr = [];
rl.on("line", (line)=>{
    if(n === undefined) {
        n = Number(line.trim())
    } else {
        [a, b, c, d, e] = line.trim().split(" ").map(Number)

        initArr.push({id: a, x: (b+d)/2, y: (c + e)/2});
        if(initArr.length === n) {
            let r = (d - b)/2
            console.log(getResult(n, initArr, r))
            //clear
            n = undefined
            initArr.length = 0
        }

    }

})

function getResult(n, initArr,  r) {
    let usedMap = {}

    //usedMap 初始化
    for (const obj of initArr) {
        usedMap[obj.id] = false
    }

    let result = []
    for (let i = 0; i <initArr.length ; i++) {
        if(usedMap[initArr[i].id]) continue;

        // 取出最顶元素
       let topObj = initArr.reduce((acc, obj)=>{
            if( !usedMap[obj.id]  && obj.y < acc.y) {
                return obj
            }
            return acc

        }, initArr[i])

        //找队友
        usedMap[topObj.id] = true;
        let temp = [topObj]
        for (let j = 0; j < initArr.length; j++) {
            if(usedMap[initArr[j].id]) continue;

            if(Math.abs(initArr[j].y - topObj.y) <= r) {
                temp.push(initArr[j])
                usedMap[initArr[j].id] = true
            }
        }
        temp.sort((a, b) => {
            return a.x - b.x
        })
        result.push(temp)
    }

    // 输出
    let finalArr = []
    for (const arr of result) {
        for (const ele of arr) {
            finalArr.push(ele.id)
        }
    }

    return finalArr.join(" ")
}